﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace TestResults
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface ITestResultsService
    {

        [OperationContract]
        Test getTestResults(String test_id, String user_id);
    }


    // Use a data contract as illustrated in the sample below to add composite types to service operations.

    [DataContract]
    public class Question
    {
        string _text;
        List<String> _answers;
        int _correctIndex;
        int _selectedIndex;

        [DataMember]
        public String QuestionText
        {
            get { return _text; }
            set { _text = value; }
        }

        [DataMember]
        public List<String> Answers
        {
            get { return _answers; }
            set { _answers = value; }
        }

        [DataMember]
        public int CorrectIndex
        {
            get { return _correctIndex; }
            set { _correctIndex = value; }
        }

        [DataMember]
        public int SelectedIndex
        {
            get { return _selectedIndex; }
            set { _selectedIndex = value; }
        }

    }

    [DataContract]
    public class Test
    {
        List<Question> _questions;
        int _score;

        [DataMember]
        public List<Question> Questions
        {
            get { return _questions; }
            set { _questions = value; }
        }

        [DataMember]
        public int Score
        {
            get { return _score; }
            set { _score = value; }
        }
    }
}
